home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 42
/
Amiga Format AFCD42 (Issue 126, Aug 1999).iso
/
-serious-
/
programming
/
other
/
gui4cli
/
docs
/
tutorials
/
lvhandler.gc
< prev
next >
Wrap
Text File
|
1999-05-14
|
2KB
|
88 lines
G4C
; This script shows simple listview handling techniques
; -------------------------------------------------------------
WINBIG 188 52 248 109 'LVHandler.gc'
wintype 11110001
; a fancy 3D title
CTEXT 12 4 "Handling a List" #screen 8 2 0 00011
; -------------------------------------------------------------
; On loading we create a small list in a file in ram:
; -------------------------------------------------------------
xonload
; an easy way to create a file is to declare an env:
; variable and then copy it to where ever you want.
; The \n thingies are ENTER characters..
.dummy = 'Monday\nTuesday\nWednesday\nThursday\nFriday\nSaturday\nSunday'
rename env:.dummy ram:List_one
; now that we have a file called ram:List_one, load
; it into our listview..
lvuse LVHandler.gc 1
lvchange RAM:List_one
; and open our window
guiopen LVHandler.gc
; -------------------------------------------------------------
; On closing, clean up and quit
; -------------------------------------------------------------
xonclose
guiquit LVHandler.gc
delete ram:List_#?
; -------------------------------------------------------------
; the status text box
; -------------------------------------------------------------
TEXT 12 20 225 14 'Showing RAM:List_one' 40 BOX
gadid 2
; -------------------------------------------------------------
; The listview
; note we start with '' as file name, indicating that
; we don't want a file yet.. we LVChange it later
; -------------------------------------------------------------
XLISTVIEW 112 36 126 68 '' v '' 0 TXT
gadid 1
; -------------------------------------------------------------
; 3 buttons which take some actions
; -------------------------------------------------------------
XBUTTON 12 56 95 14 'Sort it'
lvuse LVHandler.gc 1 ; use our list
LVSort ASC ; sort it..
; and tell everyone by updating the status text box
update LVHandler.gc 2 'Sorted the List..'
XBUTTON 12 72 95 14 'Save it'
lvuse LVHandler.gc 1
LVSave 'Ram:List_two'
update LVHandler.gc 2 'Saved List as RAM:List_two'
XBUTTON 12 88 95 14 'Revert'
lvuse LVHandler.gc 1
lvchange RAM:List_one
update LVHandler.gc 2 'Reloaded original List.'